TTYNAME
Section: C Library Functions (3)
Index
Return to Main Contents
BSD mandoc
NAME
ttyname
isatty
ttyslot
- get name of associated terminal (tty) from file descriptor
SYNOPSIS
Fd #include <unistd.h>
Ft char *
Fn ttyname int fd
Ft int
Fn isatty int fd
Ft int
Fn ttyslot
DESCRIPTION
These functions operate on the system file descriptors for terminal
type devices. These descriptors are not related to the standard
I/O
FILE
typedef, but refer to the special device files found in
/dev
and named
/dev/tty xx
and for which an entry exists
in the initialization file
/etc/ttys.
(See
ttys(5).)
The
Fn isatty
function
determines if the file descriptor
Fa fd
refers to a valid
terminal type device.
The
Fn ttyname
function
gets the related device name of
a file descriptor for which
Fn isatty
is true
The
Fn ttyslot
function
fetches the current process' control terminal number from the
ttys(5)
file entry.
RETURN VALUES
The
Fn ttyname
function
returns the null terminated name if the device is found and
Fn isatty
is true; otherwise
a
NULL
pointer is returned.
The
Fn ttyslot
function
returns the unit number of the device file if found; otherwise
the value zero is returned.
FILES
- /dev/*
-
- /etc/ttys
-
SEE ALSO
ioctl(2),
ttys(5)
HISTORY
A
Fn isatty ,
Fn ttyname ,
and
Fn ttyslot
function
appeared in
AT&T System
v7 .
BUGS
The
Fn ttyname
function leaves its result in an internal static object and returns
a pointer to that object. Subsequent calls to
Fn ttyname
will modify the same object.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUES
-
- FILES
-
- SEE ALSO
-
- HISTORY
-
- BUGS
-
This document was created by
man2html,
using the manual pages.
Time: 19:41:58 GMT, December 25, 2022